package com.tttshaoqi.controller;

import com.tttshaoqi.dto.UserDTO;
import com.tttshaoqi.entity.SysUserAuth;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tttshaoqi
 * &#064;create 2025-07-30-17:39
 */
@RestController
@RequestMapping("hello")
public class SysUserController {


    @RequestMapping("/user")
    public String helloUser(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        String name = authentication.getName();
        return "hello "+name;
    }


    @RequestMapping("/admin")
    public String helloAdmin(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        String name = authentication.getName();
        return "hello "+name;
    }
}
